import axios from '@/utils/axios'

/**
 * @author:wesley.wu
 * @param: mod
 * @time: 2018/5/8 13:40
 * @Description: 通过用户名和密码完成普通登录操作
 */
export function login (userInfo) {
  return axios({
    url: '/mobile/user/open/login',
    method: 'post',
    data: userInfo
  })
}

/**
 * @author:wesley.wu
 * @param: mod
 * @time: 2018/5/8 13:42
 * @Description: 根据手机号发送短信验证码
 */
export function sendSmsCode (userInfo) {
  return axios({
    url: '/mobile/user/open/sendSmsCode',
    method: 'post',
    data: userInfo
  })
}

/**
 * @author:wesley.wu
 * @param: mod
 * @time: 2018/5/8 13:42
 * @Description: 短信方式登录
 */
export function smsLogin (userInfo) {
  return axios({
    url: '/mobile/user/open/smsLogin',
    method: 'post',
    data: userInfo
  })
}

/**
 * @author:wesley.wu
 * @param: mod
 * @time: 2018/5/10 9:18
 * @Description:验证手机号是否合法
 */
export function validateMobile (userInfo) {
  return axios({
    url: '/mobile/user/open/validateMobile',
    method: 'post',
    data: userInfo
  })
}

/**
 * @author:wesley.wu
 * @param: mod
 * @time: 2018/5/10 9:18
 * @Description:重置密码验证手机号是否合法
 */
export function resetPwdValidMobile (userInfo) {
  return axios({
    url: '/mobile/user/open/resetPwdValidMobile',
    method: 'post',
    data: userInfo
  })
}

/**
 * @author:wesley.wu
 * @param: mod
 * @time: 2018/5/10 9:19
 * @Description:注册操作
 */
export function register (userInfo) {
  return axios({
    url: '/mobile/user/open/register',
    method: 'post',
    data: userInfo
  })
}

/**
 * @author:wesley.wu
 * @param: mod
 * @time: 2018/5/10 9:19
 * @Description:重置密码
 */
export function resetPwd (userInfo) {
  return axios({
    url: '/mobile/user/open/resetPwd',
    method: 'post',
    data: userInfo
  })
}

/**
 * @author:wesley.wu
 * @param: mod
 * @time: 2018/5/10 16:31
 * @Description:注销/登出操作
 */
export function logout () {
  return axios({
    url: '/mobile/user/logout',
    method: 'post',
  })
}
